Code
library(polyglotr)
Tony Duan
# A tibble: 194 × 2
Language `ISO-639 code`
<chr> <chr>
1 Abkhaz ab
2 Acehnese ace
3 Acholi ach
4 Afrikaans af
5 Albanian sq
6 Alur alz
7 Amharic am
8 Arabic ar
9 Armenian hy
10 Assamese as
# ℹ 184 more rows
original_word es fr
1 Hello, how are you? ¿Hola, cómo estás? Bonjour comment allez-vous?
2 I love programming! ¡Me encanta la programación! J'adore la programmation!
3 This is a test. Esta es una prueba. Ceci est un test.
zh-CN
1 你好吗?
2 我喜欢编程!
3 这是一个测试。
---
title: "Translation"
author: "Tony Duan"
execute:
warning: false
error: false
format:
html:
toc: true
toc-location: right
code-fold: show
code-tools: true
number-sections: true
code-block-bg: true
code-block-border-left: "#31BAE9"
code-copy: true
---
```{r}
library(polyglotr)
```
# Translation word
```{r}
word_translation <- linguee_word_translation("fruit", source_language = "en", target_language = "zh")
word_translation
```
# translate sentences
```{r}
google_get_supported_languages()
```
```{r}
texts <- c("Hello, how are you?",
"I love programming!",
"This is a test.")
languages <- c("es", "fr", "zh-CN")
create_translation_table(texts, languages)
```